<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="../jsLib/angular.js"></script>
    <title></title>
</head>
<body ng-app="app">
<div ng-controller="contr">
    单价：<input type="text" ng-model="price">
    数量：<input type="text" ng-model="number">
    <div ng-bind="total"></div>
    <button ng-click="tijiao()">提交</button>
    <button ng-click="reset()">重置</button>
</div>

<script>
    var app=angular.module('app',[]);
    app.controller('contr',function($scope,$timeout){
        $scope.price=12;
        $scope.number=10;
        $timeout(function(){
            $scope.price=100
        },1000);
        var totalJisuan = function(){
            $scope.total=    $scope.price*$scope.number
        }
        $scope.$watch('price',totalJisuan);
        $scope.$watch('number',totalJisuan);

        $scope.tijiao = function(){
            alert('提交成功')
        }
        $scope.reset = function(){
            $scope.price=12;
            $scope.number=10;
        }

    })
</script>
</body>
</html>